<link rel="stylesheet" href="/css/publicCss/header.css" />
<nav class="nav">
    <ul class="navLeft ul">
        <li class="li">在线考试系统</li>
        <li class="li">| 欢迎您 <i id="userName"></i></li>
    </ul>
    <ul class="navRight ul">
<!--        <a href="/admin/personal"><li class="li">个人中心</li></a>-->
<!--        <a href="/admin/myClass"><li class="li">我的班级</li></a>-->
        <a id="myExam" href="/admin/index"><li class="li">我的考试</li></a>
<!--        <a href="/admin/myExam"><li class="li">我的考试</li></a>-->
        <a onclick="loginOut()"><li class="li">退出</li></a>
    </ul>
    <div style="clear: both;"></div>
</nav>
<script src="/js/jquery.js"></script>

<script>
    $.ajax({
        type: 'POST',
        url: '/admin/login/public',
        success: function (data) {
            if(data.data == 'admin'){
                $("#myExam").remove();
            }
            $("#userName").html(data.data)
        }
    })
    function loginOut() {
        var r=confirm("确认退出")
        if (r==true){
            $.ajax({
                type: 'POST',
                url: '/admin/login/logout',
                success: function (data) {
                    if(data.err == 0){
                        // alert(data.msg )
                        window.location.href = "/admin/login"
                    }else{
                        alert(data.msg)
                    }
                }
            })
        }else {

        }

    }
</script>
